// Customization for ${Table Name}Access class.
// A custom column class that has a special "display" format.
[Serializable()]
public class MyCustomCurrencyColumn : BaseClasses.Data.CurrencyColumn
{
public MyCustomCurrencyColumn(BaseClasses.Data.CurrencyColumn col)
: base(col.Number, col.InternalName, col.Name, col.TableDefinition, null, null, null)
{
this.IsIdentity = col.IsIdentity;
this.DbDataType = col.DbDataType;
this.DefaultValue = col.DefaultValue;
this.DatabaseDefaultValue = col.DatabaseDefaultValue;
this.DisplayFormat = col.DisplayFormat;
this.DbFormat = col.DbFormat;
this.IsRequired = col.IsRequired;
this.IsIndexed = col.IsIndexed;
this.IsUnique = col.IsUnique;
this.IsValuesReadOnly = col.IsValuesReadOnly;
this.IsValuesComputed = col.IsValuesComputed;
}
// Overridden to put angle brackets around the display string.
public override string ToDisplayString(ColumnValue value, string format)
{
return string.Format("<{0}>", base.ToDisplayString(value, format));
}
}
// Overridden to customize this object's TableDefinition's ColumnList.
protected override void Initialize()
{
base.Initialize();
// Construct a custom column instance using the current ${Column Name}.
MyCustomCurrencyColumn newCol = new MyCustomCurrencyColumn(this.${Column Name}Column);
// Replace the ${Column Name} with the custom column instance.
int i;
i = this.TableDefinition.ColumnList.IndexOf(this.${Column Name}Column);
this.TableDefinition.ColumnList.RemoveAt(i);
this.TableDefinition.ColumnList.Insert(i,newCol);
}
|